﻿@using ZJK.Models.ExpertManage
@model ZJK.Models.ExpertManage.ExpertConfirm
@{
    ViewBag.Title = "专家验证管理";
    Layout = "~/Views/Shared/ExpertManage/_Layout_ExpertManage.cshtml";
}
<h2>
    @ViewBag.Title</h2>
@Styles.Render("~/Scripts/ztree/zTreeStyle.css")
@Scripts.Render("~/Scripts/ztree/jquery.ztree.all-3.5.min.js")
<script type="text/javascript" src="@Url.Content("~/Scripts/jQuery.tmpl.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Expert/Confirm.js")"></script>
<script type="text/javascript">
    //树形分类的配置项目
    var setting = {
        view: {
            selectedMulti: false
        },
        check: {
            chkboxType: { "Y": "ps", "N": "ps" },
            enable: true
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            //onClick: onClick
        }
    };

    //获取分类信息的地址
    var strUrlgetCategorys = '@Url.Content("~/Category/getCategorys")';

    //根据ID获取专家信息的地址
    var strUrlgetAExpert = '@Url.Content("~/ExpertManage/getAExpert")';

    //根据查询条件，获取专家信息列表的地址
    var strUrlgetExpertBXs = '@Url.Content("~/ExpertManage/getExperts")';

    $(document).ready(function () {
        //初始化页面对象
        initPageModel();

        //设置专家专业查询提示
        $("#Q_professional")
        .autocomplete({
            source: function (request, response) {
                // define a function to call your Action (assuming UserController)
                $.ajax({
                    url: '@Url.Content("~/Common/GetExpertProfessionals")', type: "POST", dataType: "json",

                    // query will be the param used by your action method
                    data: { keyword: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.name, value: item.name, id: item.id };
                        }))
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            },
            minLength: 1, // require at least one character from the user
            change: function (event, ui) {

            },
            select: function (event, ui) {

            }
        });

        //初始化专家分类树形
        getCategorys(strUrlgetCategorys);
    });
</script>
<div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
    @using (Html.BeginForm("Confirm", "ExpertManage", FormMethod.Post, new { id = "form_op" }))
    {
        @Html.HiddenFor(m => m.opFlag, new { @id = "opFlag" })
        @Html.HiddenFor(m => m.opThisExpertID, new { @id = "opThisExpertID" })
        @Html.HiddenFor(m => m.opThisExtractID, new { @id = "opThisExtractID" })
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>所关联的项目：</b>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <ul style="list-style-type: none; margin: 0; padding: 0;">
                    @for (int i = 0; i < Model.thisExtractRefProjects.Count; i++)
                    {
                        <li>
                            @Html.HiddenFor(c => c.thisExtractRefProjects[i].projectCode)
                            @Html.HiddenFor(c => c.thisExtractRefProjects[i].projectID)
                            @Html.HiddenFor(c => c.thisExtractRefProjects[i].projectName)
                            @Html.CheckBoxFor(x => x.thisExtractRefProjects[i].projectIsSelected)
                            @Html.DisplayFor(x => x.thisExtractRefProjects[i].projectName)
                        </li>
                    }
                </ul>
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>专家专业或类别：</b>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-header ui-corner-all" style="padding: 0.7em;">
                备选专家列表
            </div>
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-content ui-corner-all" style="position: relative; padding: 0.7em;">
                <div style="margin: 3px;">
                    专家姓名：<br />
                    <input type="text" value="" id="qName" style="width: 10em;" />
                </div>
                <div style="margin: 3px;">
                    专家专业（输入后提示）：<br />
                    <input type="text" value="" id="qProfessional" style="width: 10em;" />
                </div>
                <div style="margin: 3px;">
                    专家分类：<br />
                    <div style="height: 140px; overflow: scroll; background-color: #EEE;">
                        <ul id="treeCategory" class="ztree">
                        </ul>
                    </div>
                </div>
                <div style="margin: 3px;">
                    <span class="btn" title="按条件查询专家列表" onclick="javascript:getExpertBXs(strUrlgetExpertBXs);">
                        查询专家列表</span>
                </div>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
            点击专家信息，选定。
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <!-- 备选专家列表的模板 -->
                <script id="DataTemplate" type="text/html">
                    <li style="padding: 0.5em;">▪&nbsp;<a href="javascript:saveAExpertAsYX('{{= ID }}');">{{= Name }}&nbsp;
                            [{{= Company }}、{{= Title }}、{{= Mobile }}];</a>
                            <span style="color: Gray;">{{= Professional }}</span>
                    </li>
                </script>
                <ul style="list-style-type: none; margin: 0px; padding: 0px;" id="expertBXs">
                </ul>
                <p id="expertBXsInfo">
                </p>
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
            <div class="ui-widget-header ui-corner-all" style="position: relative; padding: 0.7em;">
                <b>已选专家列表[<span style="color: Red; font-weight: bold;" id="expertYXsCount"></span>位]</b>
            </div>
        </div>
        <div style="width: 25%; float: right; padding: 0.7em;">
            <span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
            保存当前抽取记录，将清空已有项目的抽取备选记录。
        </div>
        <div style="position: relative; margin-left: 25%; margin-right: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <span class="btn" title="按条件查询专家列表" onclick="javascript:saveProjectExtract();">保存抽取预设记录</span>
            </div>
        </div>
        <div class="splid">
        </div>
        <div style="position: relative; width: 25%; float: left;">
        </div>
        <div style="position: relative; margin-left: 25%; overflow: hidden;">
            <div class="ui-widget-content ui-corner-all" style="padding: 0.7em;">
                <!-- 已选专家列表的模板 -->
                <script id="TemplateYX" type="text/html">
                    <li style="">
                        <div>
                            <div class="ui-widget-header ui-corner-all">
                                <span style="font-size: 2em; font-weight: bold;">{{= expName }}</span>&nbsp;
                                <span>[{{= expCompany }}、{{= expTitle }}、{{= expMobile }}]</span>
                                <span style="color: Gray;">{{= expProfessional }}</span>
                            </div>
                            <div>
                                <input type="checkbox" name="cbExtractIsSucessed" value="" {{if extracResult }}checked="checked" {{/if}} id="cbExtractIsSucessed_{{= expID}}" />
                                <label for="cbExtractIsSucessed{{= expID}}">
                                    该专家是否抽取成功</label>
                                &nbsp;&nbsp;&nbsp;&nbsp;[<a href="javascript:deleteAExpertFromYX('{{= expID}}');">删除</a>]</div>
                            <div>
                            <div>
                                <strong>抽取过程提示：</strong><span style="color: Gray;">如果抽取不成功，请修改抽取不成功信息。</span><br />
                                <textarea rows="4" cols="20" name="txtExtractMessage" id="txtExtractMessage_{{= expID}}">{{= extractDescribe}}</textarea></div>
                        </div>
                        <div style="height: 20px;">
                        </div>
                    </li>
                </script>
                <ul style="list-style-type: none; margin: 0px; padding: 0px;" id="expertYXs">
                    
                </ul>
            </div>
        </div>
    }
</div>
